/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller;

import aplication.Rotulador;
import controller.util.CarregadorDeImagem;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.ResourceBundle;
import java.util.logging.Level;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;

/**
 * APENAS DISPONIVEL NA VERSAO PRÓ
 * FXML Controller class
 *
 * @author Adriano
 */
public class ConfiguracaoController implements Initializable {

    @FXML
    private ImageView addImage;
    @FXML
    private TextField addImageTextView;

    @Override
    public void initialize(URL url, ResourceBundle rb) {
        // TODO
    }

    @FXML
    private void onFileChooser(ActionEvent event) {
        try {
            File f = CarregadorDeImagem.getInstance().getFileChooser().showOpenDialog(new Stage());
            InputStream in;
            in = new FileInputStream(f);
            addImage.setImage(new Image(in));
            addImageTextView.setText(f.toString());
        } catch (FileNotFoundException ex) {
            Rotulador.getLOGGER().logp(Level.SEVERE,"log.HandlerChangeHtml","OnFileChooser",ex.getMessage());
        } catch (IOException ex) {
            Rotulador.getLOGGER().logp(Level.SEVERE,"log.HandlerChangeHtml","OnFileChooser",ex.getMessage());
        }
    }
}
